package org.xue.snowmall.bargain.utile;

/**
 * @author 小刘的小张
 * @version 1.0
 * @description: TODO
 * @date 2021/9/26 16:45
 */
public class BargainUtils {
    public static Integer reduceCount(Integer psmPrice, Integer gsmBargainPrice, Integer gsmBargainMaxCount) {
        // d 要砍掉的价格
        int d = psmPrice - gsmBargainPrice;
        //随机数的范围
        int num = d / gsmBargainMaxCount;
        int f = (int) (Math.random() * (num - (num / 1.5)) + (num / 1.5));
        d = d - f;
        int m = d;
        d -= d;

        return f;
    }

    public static Integer reducePrice(Integer psmPrice, Integer gsmBargainPrice, Integer gsmBargainMaxPrice) {

        int d = psmPrice - gsmBargainPrice;

        int price = gsmBargainMaxPrice;
        // f 砍掉的价格
        int f = (int) (Math.random() * (price - (price / 1.5)) + (price / 1.5));
        d = d - f;
        return f;
    }
}
